package com.flyingocean;

import java.io.BufferedWriter;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;

public class pushIntoFileImpl implements pushIntoFile {
	public void push(PlayerInfo p) {
		// 至此已获取HTML中的一行
		try {
			FileOutputStream file_fos = new FileOutputStream("data.txt");
			OutputStreamWriter file_osw = new OutputStreamWriter(file_fos, "UTF-8");
			BufferedWriter file = new BufferedWriter(file_osw);

			if (p.name == null)
				p.name = "null";
			file.write(p.name);
			file.write("\n");

			if (p.birthDate == null)
				p.birthDate = "null";
			file.write(p.birthDate);
			file.write("\n");

			if (p.height == null)
				p.height = "null";
			file.write(p.height);
			file.write("\n");

			if (p.weight == null)
				p.weight = "null";
			file.write(p.weight);
			file.write("\n");

			if (p.number == null)
				p.number = "null";
			file.write(p.number);
			file.write("\n");

			if (p.position == null)
				p.position = "null";
			file.write(p.position);
			file.write("\n");

			if (p.college == null)
				p.college = "null";
			file.write(p.college);
			file.write("\n");

			if (p.city == null)
				p.city = "null";
			file.write(p.city);
			file.write("\n");

			// 比赛数据
			if (p.season == null)
				p.season = "null";
			file.write(p.season);
			file.write("\n");

			if (p.tm == null)
				p.tm = "null";
			file.write(p.tm);
			file.write("\n");

			if (p.g == null)
				p.g = "null";
			file.write(p.g);
			file.write("\n");

			if (p.gs == null)
				p.gs = "null";
			file.write(p.gs);
			file.write("\n");

			if (p.mp == null)
				p.mp = "null";
			file.write(p.mp);
			file.write("\n");

			if (p.fgper == null)
				p.fgper = "null";
			file.write(p.fgper);
			file.write("\n");

			if (p.fg == null)
				p.fg = "null";
			file.write(p.fg);
			file.write("\n");

			if (p.fga == null)
				p.fga = "null";
			file.write(p.fga);
			file.write("\n");

			if (p.threepper == null)
				p.threepper = "null";
			file.write(p.threepper);
			file.write("\n");

			if (p.threep == null)
				p.threep = "null";
			file.write(p.threep);
			file.write("\n");

			if (p.threepa == null)
				p.threepa = "null";
			file.write(p.threepa);
			file.write("\n");

			if (p.ftper == null)
				p.ftper = "null";
			file.write(p.ftper);
			file.write("\n");

			if (p.ft == null)
				p.ft = "null";
			file.write(p.ft);
			file.write("\n");

			if (p.fta == null)
				p.fta = "null";
			file.write(p.fta);
			file.write("\n");

			if (p.trb == null)
				p.trb = "null";
			file.write(p.trb);
			file.write("\n");

			if (p.orb == null)
				p.orb = "null";
			file.write(p.orb);
			file.write("\n");

			if (p.drb == null)
				p.drb = "null";
			file.write(p.drb);
			file.write("\n");

			if (p.ast == null)
				p.ast = "null";
			file.write(p.ast);
			file.write("\n");

			if (p.stl == null)
				p.stl = "null";
			file.write(p.stl);
			file.write("\n");

			if (p.blk == null)
				p.blk = "null";
			file.write(p.blk);
			file.write("\n");

			if (p.tov == null)
				p.tov = "null";
			file.write(p.tov);
			file.write("\n");

			if (p.pf == null)
				p.pf = "null";
			file.write(p.pf);
			file.write("\n");

			if (p.pts == null)
				p.pts = "null";
			file.write(p.pts);
			file.write("\n");

			if (p.w == null)
				p.w = "null";
			file.write(p.w);
			file.write("\n");

			if (p.l == null)
				p.l = "null";
			file.write(p.l);
			file.write("\n");
			// 换行

			file.close();
			file_osw.close();
			file_fos.close();

		} catch (IOException e) {
			System.out.println("Error:" + e.getMessage());
		}

	}
}
